#include <iostream>
using namespace std;
class Duck{
	public:
//		virtual void quack(){ cout << "quack" << endl;}
		virtual void swim(){cout << "swim" << endl;}
//		virtual void fly() {cout << "fly" << endl;}
		virtual void display() = 0;
};

class Flyable{
	public:
	virtual void fly() = 0;
};

class Quackable{
	public:
	virtual void quack() = 0;
};

class MallardDuck:public Duck,public Flyable,public Quackable{
	public:
		virtual void quack(){ cout << "quack" << endl;}
		virtual void fly() {cout << "fly" << endl;}
		virtual void display(){cout << "show MallardDuck" << endl;}
};

class RedheadDuck:public Duck,public Flyable,public Quackable{
	public:
		virtual void quack(){ cout << "quack" << endl;}
		virtual void fly() {cout << "fly" << endl;}
		virtual void display(){cout << "show RedheadDuck" <<endl;}
};

class RubberDuck:public Duck,public Quackable{
	public:
	virtual void quack(){ cout << "zz quack" << endl;}
	virtual void display(){cout << "show RubberDuck" <<endl;}
};

class DecoyDuck:public Duck{
	virtual void swim(){cout << "can not swim" << endl;}
	virtual void display(){cout << "show DecoyDuck" <<endl;}
};

int main(){
	RubberDuck *duck = new RubberDuck();
	duck->quack();
	duck->display();
	return 0;
}
